﻿// Decompiled with JetBrains decompiler
// Type: Netick.NetworkString8
// Assembly: Netick, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 6726ECA1-C773-4CF7-8952-E81B30D93B52
// Assembly location: D:\WorkSpaceDemo\UPM\NetickForUnity\Netick\Runtime\Netick.dll
// XML documentation location: D:\WorkSpaceDemo\UPM\NetickForUnity\Netick\Runtime\Netick.xml

using System;

#nullable disable
namespace Netick;

/// <summary>
/// Represents a fixed-size network-serializable string with a maximum length of 8 characters.
/// </summary>
[Serializable]
public struct NetworkString8
{
  internal const int Size = 8;
  public FixedSize8<ushort> RawValue;

  public unsafe NetworkString8(string value)
  {
    fixed (NetworkString8* ptrChar = &this)
      NetworkStringHelper.SetString(value, (char*) ptrChar, Math.Min(8, value.Length));
  }

  public override unsafe string ToString()
  {
    fixed (NetworkString8* ptrChar = &this)
      return NetworkStringHelper.GetString((char*) ptrChar, 8);
  }

  public static implicit operator NetworkString8(string val) => new NetworkString8(val);

  public static implicit operator string(NetworkString8 val) => val.ToString();
}
